home *** CD-ROM | disk | FTP | other *** search
- Path: familynews.cycor.ca!usenet
- From: gcaine@cycor.ca (gcaine)
- Newsgroups: comp.sys.amiga.programmer
- Subject: Re: Referances troubble
- Date: 22 Feb 1996 14:56:26 GMT
- Organization: Cycor Communications Inc., Coast to Coast Internet Services
- Message-ID: <1143.6626T526T2599@cycor.ca>
- References: <1266.6624T117T1455@himolde.no>
- NNTP-Posting-Host: skt-as012.cycor.ca
- X-Newsreader: THOR 2.22 (Amiga;TCP/IP)
-
-
- >Ok, I have aslight problem with references. The problem is that I have to
- >pass a few pointers to a subroutine, where things are done to them, and then
- >they are passed back. Now, what I hoped would work was something like this
-
- >void Tester(void &Testering)
- >{
- > printf("%i\n",Testering);
- > Testering = AllocMem(100, MEMF_CHIP|MEMF_CLEAR);
- > printf("%i\n",Testering);
- >}
-
- >void main(void)
- >{
- > void *Test;
-
- > printf("%i\n",Test);
- > Tester(Test);
-
- > printf("%i\n",Test);
- >// FreeMem(Test, 100);
- >}
-
- I'm not sure what your printf's are supposed to print, but I think I know
- what you are trying to do.
-
- First change Tester to this:
-
- void Tester(void *Testering)
- {
- printf("%d\n", Testering); /* prints the address of Testering, which
- hasn't been Allocated yet */
-
- if (Testering = AllocMem(100, MEMF_CHIP | MEMF_CLEAR))
- {
- printf("%d\n", Testering); /* prints the address of Testering */
- printf("%d\n", &Testering); /* prints the contents of Testering
- which is 0 */
- }
- }
-
- Gary Caine Member: Team AMIGA
-
-